using System;
using NUnit.Framework;
using DotNetXmlSwfChart;

namespace DotNetXmlSwfChart.UnitTest
{
    [TestFixture]
    public class ChartTransitionFixture
    {
        [Test]
        public void BlinkTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.blink, TransitionOrder.all);
        }

        [Test]
        public void BlinkTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.blink, TransitionOrder.series);
        }

        [Test]
        public void BlinkTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.blink, TransitionOrder.category);
        }

        [Test]
        public void DissolveTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.dissolve, TransitionOrder.all);
        }

        [Test]
        public void DissolveTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.dissolve, TransitionOrder.series);
        }

        [Test]
        public void DissolveTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.dissolve, TransitionOrder.category);
        }

        [Test]
        public void DropTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.drop, TransitionOrder.all);
        }

        [Test]
        public void DropTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.drop, TransitionOrder.series);
        }

        [Test]
        public void DropTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.drop, TransitionOrder.category);
        }

        [Test]
        public void SpinTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.spin, TransitionOrder.all);
        }

        [Test]
        public void SpinTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.spin, TransitionOrder.series);
        }

        [Test]
        public void SpinTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.spin, TransitionOrder.category);
        }

        [Test]
        public void ScaleTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.scale, TransitionOrder.all);
        }

        [Test]
        public void ScaleTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.scale, TransitionOrder.series);
        }

        [Test]
        public void ScaleTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.scale, TransitionOrder.category);
        }

        [Test]
        public void ZoomTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.zoom, TransitionOrder.all);
        }

        [Test]
        public void ZoomTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.zoom, TransitionOrder.series);
        }

        [Test]
        public void ZoomTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.zoom, TransitionOrder.category);
        }

        [Test]
        public void SlideRightTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.slide_right, TransitionOrder.all);
        }

        [Test]
        public void SlideRightTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.slide_right, TransitionOrder.series);
        }

        [Test]
        public void SlideRightTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.slide_right, TransitionOrder.category);
        }

        [Test]
        public void SlideLeftTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.slide_left, TransitionOrder.all);
        }

        [Test]
        public void SlideLeftTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.slide_left, TransitionOrder.series);
        }

        [Test]
        public void SlideLeftTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.slide_left, TransitionOrder.category);
        }

        [Test]
        public void SlideUpTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.slide_up, TransitionOrder.all);
        }

        [Test]
        public void SlideUpTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.slide_up, TransitionOrder.series);
        }

        [Test]
        public void SlideUpTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.slide_up, TransitionOrder.category);
        }

        [Test]
        public void SlideDownTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.slide_down, TransitionOrder.all);
        }

        [Test]
        public void SlideDownTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.slide_down, TransitionOrder.series);
        }

        [Test]
        public void SlideDownTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.slide_down, TransitionOrder.category);
        }

        [Test]
        public void NoTransitionOrderAllToSourceXml()
        {
            ToSourceXml(TransitionType.none, TransitionOrder.all);
        }

        [Test]
        public void NoTransitionOrderSeriesToSourceXml()
        {
            ToSourceXml(TransitionType.none, TransitionOrder.series);
        }

        [Test]
        public void NoTransitionOrderCategoryToSourceXml()
        {
            ToSourceXml(TransitionType.none, TransitionOrder.category);
        }

        private void ToSourceXml(TransitionType type, TransitionOrder order)
        {
            string testXml =
                "<chart_transition type='{0}' " +
                                  "delay='1.2' " +
                                  "duration='2.5' " +
                                  "order='{1}' " +
                                  "/>";
            ChartTransition ct = new ChartTransition();
            ct.TransitionType = type;
            ct.Delay = 1.2;
            ct.Duration = 2.5;
            ct.Order = order;

            Assert.AreEqual(
                string.Format(testXml, type.ToString(), order.ToString()),
                ct.ToSourceXML());
        }
    }
}
